package demo1104.demo01;

import java.util.function.Supplier;

/**
 * @author JYH
 * @version 1.0
 * @date 2022/11/4 16:02
 */
public class TestInst {
    public static void main(String[] args) {
        People p1 = new People("食物", "跑步");
        //Supplier<String> supplier = ()->p1.getEat();
        Supplier<String> supplier =p1::getEat;
        System.out.println(supplier.get());
    }
}
class People{
    private String eat;
    private String run;

    public String getEat() {
        return eat;
    }

    public void setEat(String eat) {
        this.eat = eat;
    }

    public String getRun() {
        return run;
    }

    public void setRun(String run) {
        this.run = run;
    }

    public People(String eat, String run) {
        this.eat = eat;
        this.run = run;
    }

    @Override
    public String toString() {
        return "People{" +
                "eat='" + eat + '\'' +
                ", run='" + run + '\'' +
                '}';
    }
}